package com.example.learnnacos.tasks;

import com.example.learnnacos.clients.svc.HelloClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;

@Slf4j
@Service
public class HelloBasicProcessor implements BasicProcessor {

    @Autowired
    private HelloClient helloClient;

    @Override
    public ProcessResult process(TaskContext taskContext) throws Exception {
        log.info("HelloBasicProcessor taskContext={}", taskContext);
        helloClient.callHello();
        return new ProcessResult(true, "result is true");
    }
}
